package com.mxchip.livestarmobile.mobile.av.screen;



import com.mxchip.livestarmobile.mobile.ui.call.AVDevice;

import java.util.Objects;

public class DecoderScreen implements Screen {

    public DecoderScreen(AVDevice avDevice) {
        this.decoderName = avDevice.getUid() + "_" + avDevice.getDeviceName();
        this.deviceUid = avDevice.getUid();
        this.deviceName = avDevice.getDeviceName();

        if(avDevice.getDeviceName().equals(AVDevice.CAMERA_LOCAL_SMALL)) {
            this.decodeWidth = 640;
            this.decodeHeight = 480;
        }

        if(avDevice.getDeviceName().equals(AVDevice.CAMERA_LOCAL)) {
            this.decodeWidth = 1280;
            this.decodeHeight = 720;
        }

        if(avDevice.getDeviceName().equals(AVDevice.CAMERA_HDMI)) {
            this.decodeWidth = 1920;
            this.decodeHeight = 1080;
        }

        if(avDevice.getDeviceName().equals(AVDevice.CAMERA_WIFI)) {
            this.decodeWidth = 1920;
            this.decodeHeight = 1080;
        }
    }

    public String deviceUid;
    public String deviceName;
    public String decoderName;
    private int decodeWidth;
    private int decodeHeight;
    private String decoderMimeType = "video/avc";

    public String getDecoderMimeType() {
        return decoderMimeType;
    }

    public int getDecodeHeight() {
        return decodeHeight;
    }

    public int getDecodeWidth() {
        return decodeWidth;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DecoderScreen that = (DecoderScreen) o;
        return decoderName.equals(that.decoderName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(decoderName);
    }
}
